require 'test/unit'
require 'lib/smppclient/pdu/command_id'
require 'lib/smppclient/pdu/pdu'

class TestCommadId < MiniTest::Unit::TestCase

  include SmppClient::Pdu

  def test_values
    assert_equal(0x80000000, CommandId::GENERIC_NACK)
    assert_equal(0x00000001, CommandId::BIND_RECEIVER)
    assert_equal(0x80000001, CommandId::BIND_RECEIVER_RESP)
    assert_equal(0x00000002, CommandId::BIND_TRANSMITTER)
    assert_equal(0x80000002, CommandId::BIND_TRANSMITTER_RESP)
    assert_equal(0x00000003, CommandId::QUERY_SM)
    assert_equal(0x80000003, CommandId::QUERY_SM_RESP)
    assert_equal(0x00000004, CommandId::SUBMIT_SM)
    assert_equal(0x80000004, CommandId::SUBMIT_SM_RESP)
    assert_equal(0x00000005, CommandId::DELIVER_SM)
    assert_equal(0x80000005, CommandId::DELIVER_SM_RESP)
    assert_equal(0x00000006, CommandId::UNBIND)
    assert_equal(0x80000006, CommandId::UNBIND_RESP)
    assert_equal(0x00000007, CommandId::REPLACE_SM)
    assert_equal(0x80000007, CommandId::REPLACE_SM_RESP)
    assert_equal(0x00000008, CommandId::CANCEL_SM)
    assert_equal(0x80000008, CommandId::CANCEL_SM_RESP)
    assert_equal(0x00000009, CommandId::BIND_TRANSCEIVER)
    assert_equal(0x80000009, CommandId::BIND_TRANSCEIVER_RESP)
    assert_equal(0x0000000B, CommandId::OUTBIND)
    assert_equal(0x00000015, CommandId::ENQUIRE_LINK)
    assert_equal(0x80000015, CommandId::ENQUIRE_LINK_RESP)
    assert_equal(0x00000021, CommandId::SUBMIT_MULTI)
    assert_equal(0x80000021, CommandId::SUBMIT_MULTI_RESP)
    assert_equal(0x00000102, CommandId::ALERT_NOTIFICATION)
    assert_equal(0x00000103, CommandId::DATA_SM)
    assert_equal(0x80000103, CommandId::DATA_SM_RESP)
  end

  def test_custom
    CommandId.const_set("NEW_COMMAND_ID_TEST", 0x11111111)
    assert_equal(0x11111111, CommandId::NEW_COMMAND_ID_TEST)
  end

end